(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 3818719, 67004] NotebookOptionsPosition[ 3783656, 65991] NotebookOutlinePosition[ 3785253, 66040] CellTagsIndexPosition[ 3784894, 66029] WindowFrame->Normal ContainsDynamic->True *) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"2", "-", "2"}]], "Input", CellChangeTimes->{{3.394552301337021*^9, 3.394552301584775*^9}}], Cell[BoxData["0"], "Output", CellChangeTimes->{3.394552303364355*^9, 3.395450858459072*^9}] }, Open ]], Cell[CellGroupData[{ Cell[TextData[{ "Physicist's Introduction to ", StyleBox["Mathematica", FontSlant->"Italic"], " 6" }], "Title", CellChangeTimes->{{3.394579470096292*^9, 3.3945794805215673`*^9}, 3.395926490703081*^9}, FontColor->RGBColor[0, 0, 1]], Cell[TextData[StyleBox["Third Edition 2007", FontSlant->"Italic"]], "Subtitle", CellChangeTimes->{{3.394579519605548*^9, 3.3945795336356897`*^9}, { 3.394579849753665*^9, 3.3945798497607594`*^9}}], Cell["PHYSICS 200", "Subtitle", CellChangeTimes->{{3.394579873314529*^9, 3.3945798826114264`*^9}}], Cell[CellGroupData[{ Cell["Nicholas Wheeler", "Author", CellChangeTimes->{{3.39457972270331*^9, 3.3945797314311037`*^9}}], Cell["REED COLLEGE", "Institution", CellChangeTimes->{{3.3945797341591387`*^9, 3.39457973632885*^9}, { 3.394579793724296*^9, 3.3945797937303047`*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["", "Author", CellChangeTimes->{{3.395421842987708*^9, 3.39542184299395*^9}}], Cell["", "Institution", CellChangeTimes->{{3.395421843429604*^9, 3.39542184343263*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["", "Author", CellChangeTimes->{{3.3954218541724863`*^9, 3.3954218541752357`*^9}}], Cell["", "Institution"] }, Open ]], Cell[CellGroupData[{ Cell[TextData[StyleBox["Laboratory 5", FontColor->RGBColor[1, 0, 0]]], "Subtitle", CellChangeTimes->{{3.394581250479834*^9, 3.394581255896365*^9}, 3.394810647542058*^9, 3.394904595337902*^9, 3.3950042110191517`*^9, 3.395421873418894*^9}], Cell[CellGroupData[{ Cell["Partial Differential Equations", "Section", CellChangeTimes->{{3.3950050750221233`*^9, 3.3950050875924597`*^9}, { 3.395422438918091*^9, 3.395422447760174*^9}}], Cell[TextData[{ "When you ask ", StyleBox["Mathematica", FontSlant->"Italic"], " to solve an ", StyleBox["ordinary", FontSlant->"Italic"], " DE\[LongDash]say" }], "Text"], Cell[BoxData[ StyleBox[ RowBox[{ RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", SuperscriptBox["x", "2"]}], ")"}], RowBox[{ RowBox[{"y", "''"}], "[", "x", "]"}]}], "-", RowBox[{"x", " ", RowBox[{ RowBox[{"y", "'"}], "[", "x", "]"}]}], "+", RowBox[{ SuperscriptBox["n", "2"], " ", RowBox[{"y", "[", "x", "]"}]}]}], "\[Equal]", "0"}], "Output", FontColor->GrayLevel[0.500008]]], "Input"], Cell["or", "Text", CellChangeTimes->{{3.395422492475142*^9, 3.395422492735538*^9}}], Cell[BoxData[ StyleBox[ RowBox[{ RowBox[{ RowBox[{ RowBox[{"x", "''"}], "[", "t", "]"}], "+", RowBox[{"b", " ", RowBox[{ RowBox[{"x", "'"}], "[", "t", "]"}]}], "+", RowBox[{ SuperscriptBox["\[Omega]", "2"], " ", RowBox[{"x", "[", "t", "]"}]}]}], "\[Equal]", RowBox[{"DiracDelta", "[", "t", "]"}]}], "Output", FontColor->GrayLevel[0.500008]]], "Input"], Cell[TextData[{ "\[LongDash]it has powerful resources to draw upon (the \"Kovacic algorithm,\ \" \"Bocharov techniques,\" ", StyleBox["etc", FontSlant->"Italic"], ".\[Ellipsis]with altogether use about 300 pages of ", StyleBox["Mathematica", FontSlant->"Italic"], " code and 200 pages of C code, we are told), and often has immediate things \ to say:" }], "Text"], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{"DSolve", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", SuperscriptBox["x", "2"]}], ")"}], RowBox[{ RowBox[{"y", "''"}], "[", "x", "]"}]}], "-", RowBox[{"x", " ", RowBox[{ RowBox[{"y", "'"}], "[", "x", "]"}]}], "+", RowBox[{ SuperscriptBox["n", "2"], " ", RowBox[{"y", "[", "x", "]"}]}]}], "\[Equal]", "0"}], ",", RowBox[{"y", "[", "x", "]"}], ",", "x"}], "]"}], "\[IndentingNewLine]", RowBox[{"DSolve", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{"x", "''"}], "[", "t", "]"}], "+", RowBox[{"b", " ", RowBox[{ RowBox[{"x", "'"}], "[", "t", "]"}]}], "+", RowBox[{ SuperscriptBox["\[Omega]", "2"], " ", RowBox[{"x", "[", "t", "]"}]}]}], "\[Equal]", RowBox[{"DiracDelta", "[", "t", "]"}]}], ",", RowBox[{"x", "[", "t", "]"}], ",", "t"}], "]"}]}], "Input", CellChangeTimes->{{3.395422627437413*^9, 3.395422628301581*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{"{", RowBox[{ RowBox[{"y", "[", "x", "]"}], "\[Rule]", RowBox[{ RowBox[{ RowBox[{"C", "[", "1", "]"}], " ", RowBox[{"Cosh", "[", RowBox[{"n", " ", RowBox[{"Log", "[", RowBox[{"x", "+", SqrtBox[ RowBox[{ RowBox[{"-", "1"}], "+", SuperscriptBox["x", "2"]}]]}], "]"}]}], "]"}]}], "+", RowBox[{"\[ImaginaryI]", " ", RowBox[{"C", "[", "2", "]"}], " ", RowBox[{"Sinh", "[", RowBox[{"n", " ", RowBox[{"Log", "[", RowBox[{"x", "+", SqrtBox[ RowBox[{ RowBox[{"-", "1"}], "+", SuperscriptBox["x", "2"]}]]}], "]"}]}], "]"}]}]}]}], "}"}], "}"}]], "Output", CellChangeTimes->{3.395422636744318*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{"{", RowBox[{ RowBox[{"x", "[", "t", "]"}], "\[Rule]", RowBox[{ RowBox[{ SuperscriptBox["\[ExponentialE]", RowBox[{ FractionBox["1", "2"], " ", "t", " ", RowBox[{"(", RowBox[{ RowBox[{"-", "b"}], "-", SqrtBox[ RowBox[{ SuperscriptBox["b", "2"], "-", RowBox[{"4", " ", SuperscriptBox["\[Omega]", "2"]}]}]]}], ")"}]}]], " ", RowBox[{"C", "[", "1", "]"}]}], "+", RowBox[{ SuperscriptBox["\[ExponentialE]", RowBox[{ FractionBox["1", "2"], " ", "t", " ", RowBox[{"(", RowBox[{ RowBox[{"-", "b"}], "+", SqrtBox[ RowBox[{ SuperscriptBox["b", "2"], "-", RowBox[{"4", " ", SuperscriptBox["\[Omega]", "2"]}]}]]}], ")"}]}]], " ", RowBox[{"C", "[", "2", "]"}]}], "-", FractionBox[ RowBox[{ RowBox[{"(", RowBox[{ SuperscriptBox["\[ExponentialE]", RowBox[{ FractionBox["1", "2"], " ", "t", " ", RowBox[{"(", RowBox[{ RowBox[{"-", "b"}], "-", SqrtBox[ RowBox[{ SuperscriptBox["b", "2"], "-", RowBox[{"4", " ", SuperscriptBox["\[Omega]", "2"]}]}]]}], ")"}]}]], "-", SuperscriptBox["\[ExponentialE]", RowBox[{ FractionBox["1", "2"], " ", "t", " ", RowBox[{"(", RowBox[{ RowBox[{"-", "b"}], "+", SqrtBox[ RowBox[{ SuperscriptBox["b", "2"], "-", RowBox[{"4", " ", SuperscriptBox["\[Omega]", "2"]}]}]]}], ")"}]}]]}], ")"}], " ", RowBox[{"HeavisideTheta", "[", "t", "]"}]}], SqrtBox[ RowBox[{ SuperscriptBox["b", "2"], "-", RowBox[{"4", " ", SuperscriptBox["\[Omega]", "2"]}]}]]]}]}], "}"}], "}"}]], "Output", CellChangeTimes->{3.39542263729389*^9}] }, Open ]], Cell[TextData[{ "And when those techniques fail one can proceed numerically, with ", StyleBox["NDSolve", "Input"], ", as we have had occasion to see." }], "Text", CellChangeTimes->{{3.395422680038759*^9, 3.395422691977124*^9}}], Cell["", "Text", CellChangeTimes->{{3.39542270141661*^9, 3.3954227014636087`*^9}}], Cell["", "Text"], Cell[TextData[{ StyleBox["Partial", FontSlant->"Italic"], " differential equations (PDEs) are, however, a different story. Though " }], "Text", CellChangeTimes->{3.395422722482244*^9}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"?", StyleBox["DSolve", FontColor->RGBColor[1, 0, 0]]}]], "Input"], Cell[BoxData[ RowBox[{ StyleBox["\<\"\\!\\(\\*RowBox[{\\\"DSolve\\\", \\\"[\\\", RowBox[{StyleBox[\ \\\"eqn\\\", \\\"TI\\\"], \\\",\\\", StyleBox[\\\"y\\\", \\\"TI\\\"], \\\",\\\ \", StyleBox[\\\"x\\\", \\\"TI\\\"]}], \\\"]\\\"}]\\) solves a differential \ equation for the function \\!\\(\\*StyleBox[\\\"y\\\", \\\"TI\\\"]\\), with \ independent variable\[NonBreakingSpace]\\!\\(\\*StyleBox[\\\"x\\\", \ \\\"TI\\\"]\\). \\n\\!\\(\\*RowBox[{\\\"DSolve\\\", \\\"[\\\", \ RowBox[{RowBox[{\\\"{\\\", RowBox[{SubscriptBox[StyleBox[\\\"eqn\\\", \ \\\"TI\\\"], StyleBox[\\\"1\\\", \\\"TR\\\"]], \\\",\\\", \ SubscriptBox[StyleBox[\\\"eqn\\\", \\\"TI\\\"], StyleBox[\\\"2\\\", \ \\\"TR\\\"]], \\\",\\\", StyleBox[\\\"\[Ellipsis]\\\", \\\"TR\\\"]}], \\\"}\\\ \"}], \\\",\\\", RowBox[{\\\"{\\\", RowBox[{SubscriptBox[StyleBox[\\\"y\\\", \ \\\"TI\\\"], StyleBox[\\\"1\\\", \\\"TR\\\"]], \\\",\\\", \ SubscriptBox[StyleBox[\\\"y\\\", \\\"TI\\\"], StyleBox[\\\"2\\\", \ \\\"TR\\\"]], \\\",\\\", StyleBox[\\\"\[Ellipsis]\\\", \\\"TR\\\"]}], \\\"}\\\ \"}], \\\",\\\", StyleBox[\\\"x\\\", \\\"TI\\\"]}], \\\"]\\\"}]\\) solves a \ list of differential equations. \\n\\!\\(\\*RowBox[{\\\"DSolve\\\", \ \\\"[\\\", RowBox[{StyleBox[\\\"eqn\\\", \\\"TI\\\"], \\\",\\\", \ StyleBox[\\\"y\\\", \\\"TI\\\"], \\\",\\\", RowBox[{\\\"{\\\", \ RowBox[{SubscriptBox[StyleBox[\\\"x\\\", \\\"TI\\\"], StyleBox[\\\"1\\\", \ \\\"TR\\\"]], \\\",\\\", SubscriptBox[StyleBox[\\\"x\\\", \\\"TI\\\"], \ StyleBox[\\\"2\\\", \\\"TR\\\"]], \\\",\\\", StyleBox[\\\"\[Ellipsis]\\\", \\\ \"TR\\\"]}], \\\"}\\\"}]}], \\\"]\\\"}]\\) solves a partial differential \ equation. \"\>", "MSG"], " ", ButtonBox[ StyleBox["\[RightSkeleton]", "SR"], Active->True, BaseStyle->"Link", ButtonData->"paclet:ref/DSolve"]}]], "Print", "PrintUsage", CellChangeTimes->{3.395422761795356*^9}, CellTags->"Info3395397561-1914138"] }, Open ]], Cell[TextData[{ "does speak of PDEs, and ", StyleBox["Mathematica", FontSlant->"Italic"], " is by no means powerless in this area (follow the ", StyleBox["\[RightSkeleton]", FontColor->RGBColor[0, 0, 1]], " and go to ", StyleBox["Scope", FontWeight->"Bold"], " > ", StyleBox["Partial Differential Equations", FontWeight->"Bold"], "), it often responds unhelpfully. Look, for example, to the physically \ important ", StyleBox["one-dimensional heat equation (diffusion equation)", FontColor->RGBColor[0, 0, 1]], " " }], "Text", CellChangeTimes->{{3.395422901200583*^9, 3.395422910739802*^9}, { 3.395422953618615*^9, 3.395422990374802*^9}, {3.3954232174684057`*^9, 3.3954232447727623`*^9}}], Cell[BoxData[ StyleBox[ RowBox[{ RowBox[{ SubscriptBox["\[PartialD]", "t"], " ", RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}], "\[Equal]", RowBox[{"a", " ", RowBox[{ SubscriptBox["\[PartialD]", RowBox[{"x", ",", "x"}]], RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}]}]}], "Output", FontColor->GrayLevel[0.500008]]], "Input"], Cell["concerning which we are told nothing at all:", "Text"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"DSolve", "[", RowBox[{ RowBox[{ RowBox[{ SubscriptBox["\[PartialD]", "t"], RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}], "\[Equal]", RowBox[{"a", " ", RowBox[{ SubscriptBox["\[PartialD]", RowBox[{"x", ",", "x"}]], RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}]}]}], ",", RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", "t"}], "}"}]}], "]"}]], "Input", CellChangeTimes->{{3.3954231928377438`*^9, 3.395423198305299*^9}}], Cell[BoxData[ RowBox[{"DSolve", "[", RowBox[{ RowBox[{ RowBox[{ SuperscriptBox["u", TagBox[ RowBox[{"(", RowBox[{"0", ",", "1"}], ")"}], Derivative], MultilineFunction->None], "[", RowBox[{"x", ",", "t"}], "]"}], "\[Equal]", RowBox[{"a", " ", RowBox[{ SuperscriptBox["u", TagBox[ RowBox[{"(", RowBox[{"2", ",", "0"}], ")"}], Derivative], MultilineFunction->None], "[", RowBox[{"x", ",", "t"}], "]"}]}]}], ",", RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", "t"}], "}"}]}], "]"}]], "Output", CellChangeTimes->{{3.395423184474687*^9, 3.3954232029294033`*^9}}] }, Open ]], Cell[TextData[{ "It has been my experience that if I\[LongDash]confronted with a PDE\ \[LongDash]have a plan of attack, then ", StyleBox["Mathematica", FontSlant->"Italic"], " will assist me in management of the details. But ", StyleBox["Mathematica", FontSlant->"Italic"], " will not usually devise or even suggest a plan of attack; for those I must \ read books. PDE's are not nearly so \"cut and dried\" as ODEs. Let us look to \ an illustrative instance:" }], "Text", CellChangeTimes->{3.395423286774637*^9}], Cell["", "Text", CellChangeTimes->{{3.395423291576294*^9, 3.395423291614357*^9}}], Cell["", "Text"], Cell[CellGroupData[{ Cell[TextData[StyleBox["Waves on a String", FontColor->RGBColor[1, 0, 0]]], "Subsection", CellChangeTimes->{{3.395423313266528*^9, 3.395423319561233*^9}, { 3.3955067836453648`*^9, 3.395506783662636*^9}}], Cell["", "Text", CellChangeTimes->{{3.395506794501401*^9, 3.395506794513232*^9}}], Cell[CellGroupData[{ Cell[TextData[StyleBox["Form of the General Solution", FontColor->RGBColor[0, 0, 1]]], "Subsubsection", CellChangeTimes->{{3.395506754508439*^9, 3.395506759302271*^9}, { 3.395506890374033*^9, 3.395506898632661*^9}}], Cell["The one dimensional wave equation reads", "Text"], Cell[BoxData[ StyleBox[ RowBox[{ RowBox[{ RowBox[{ SuperscriptBox["c", "2"], RowBox[{ SubscriptBox["\[PartialD]", RowBox[{"x", ",", "x"}]], RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}]}], "-", RowBox[{ SubscriptBox["\[PartialD]", RowBox[{"t", ",", "t"}]], RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}]}], "\[Equal]", "0"}], "Output", FontColor->GrayLevel[0.500008]]], "Input"], Cell[TextData[{ "where ", StyleBox["c", "Input", FontColor->GrayLevel[0.5]], " is a constant characteristic of the string: it has the physical dimensions \ of a \"velocity,\" and should not be confused with the \"velocity of light.\" \ Proceeding " }], "Text", CellChangeTimes->{{3.395426014308614*^9, 3.39542611798601*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"DSolve", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ SuperscriptBox["c", "2"], RowBox[{ SubscriptBox["\[PartialD]", RowBox[{"x", ",", "x"}]], RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}]}], "-", RowBox[{ SubscriptBox["\[PartialD]", RowBox[{"t", ",", "t"}]], RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}]}], "\[Equal]", "0"}], ",", RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", "t"}], "}"}]}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"{", RowBox[{"{", RowBox[{ RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}], "\[Rule]", RowBox[{ RowBox[{ RowBox[{"C", "[", "1", "]"}], "[", RowBox[{"t", "-", FractionBox[ RowBox[{ SqrtBox[ SuperscriptBox["c", "2"]], " ", "x"}], SuperscriptBox["c", "2"]]}], "]"}], "+", RowBox[{ RowBox[{"C", "[", "2", "]"}], "[", RowBox[{"t", "+", FractionBox[ RowBox[{ SqrtBox[ SuperscriptBox["c", "2"]], " ", "x"}], SuperscriptBox["c", "2"]]}], "]"}]}]}], "}"}], "}"}]], "Output", CellChangeTimes->{3.39542596662884*^9}] }, Open ]], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], " informs us\[LongDash]this being the purport of its use of ", StyleBox["free-floating square brackets", FontVariations->{"Underline"->True}], " (with no function name attached)\[LongDash]that we obtain a solution when \ we write" }], "Text", CellChangeTimes->{{3.396092727106855*^9, 3.396092739868848*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}], ":=", RowBox[{ RowBox[{"F", "[", RowBox[{"t", "+", FractionBox["x", "c"]}], "]"}], "+", RowBox[{"G", "[", RowBox[{"t", "-", FractionBox["x", "c"]}], "]"}], " ", RowBox[{"(*", RowBox[{ RowBox[{"Any", " ", RowBox[{"F", "[", "]"}]}], ",", " ", RowBox[{"any", " ", RowBox[{"G", "[", "]"}]}]}], "*)"}]}]}]], "Input"], Cell["\<\ You had occasion already in 1st-year physics to review the elementary \ argument that leads to this powerful conclusion, but check it out:\ \>", "Text", CellChangeTimes->{{3.395426268986374*^9, 3.395426316541328*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{ SuperscriptBox["c", "2"], RowBox[{ SubscriptBox["\[PartialD]", RowBox[{"x", ",", "x"}]], RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}]}], "-", RowBox[{ SubscriptBox["\[PartialD]", RowBox[{"t", ",", "t"}]], RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}]}], "\[Equal]", "0"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"-", RowBox[{ SuperscriptBox["F", "\[Prime]\[Prime]", MultilineFunction->None], "[", RowBox[{"t", "+", FractionBox["x", "c"]}], "]"}]}], "-", RowBox[{ SuperscriptBox["G", "\[Prime]\[Prime]", MultilineFunction->None], "[", RowBox[{"t", "-", FractionBox["x", "c"]}], "]"}], "+", RowBox[{ SuperscriptBox["c", "2"], " ", RowBox[{"(", RowBox[{ FractionBox[ RowBox[{ SuperscriptBox["F", "\[Prime]\[Prime]", MultilineFunction->None], "[", RowBox[{"t", "+", FractionBox["x", "c"]}], "]"}], SuperscriptBox["c", "2"]], "+", FractionBox[ RowBox[{ SuperscriptBox["G", "\[Prime]\[Prime]", MultilineFunction->None], "[", RowBox[{"t", "-", FractionBox["x", "c"]}], "]"}], SuperscriptBox["c", "2"]]}], ")"}]}]}], "\[Equal]", "0"}]], "Output", CellChangeTimes->{3.395426355033321*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Simplify", "[", "%", "]"}]], "Input", CellChangeTimes->{{3.3954263805894423`*^9, 3.3954263857321577`*^9}}], Cell[BoxData["True"], "Output", CellChangeTimes->{3.395426392124337*^9}] }, Open ]], Cell[BoxData[ RowBox[{"Clear", "[", "u", "]"}]], "Input", CellChangeTimes->{{3.395426470872953*^9, 3.395426474828554*^9}}], Cell["", "Text", CellChangeTimes->{{3.395426481637868*^9, 3.395426481677244*^9}}] }, Open ]], Cell[CellGroupData[{ Cell[TextData[StyleBox["Accommodating Prescribed Initial Conditions: \ d'Alembert's Formula", FontColor->RGBColor[0, 0, 1]]], "Subsubsection", CellChangeTimes->{{3.395506854552147*^9, 3.395506866255911*^9}, { 3.395506951422105*^9, 3.395506957114236*^9}, {3.395507003380599*^9, 3.395507021762438*^9}}], Cell["\<\ Suppose we sought a solution that conforms to prescribed initial conditions:\ \>", "Text", CellChangeTimes->{{3.3955069241630707`*^9, 3.395506935585252*^9}}], Cell[BoxData[{ StyleBox[ RowBox[{ StyleBox[ RowBox[{ RowBox[{"u", "[", RowBox[{"x", ",", "0"}], "]"}], "=", RowBox[{"f", "[", "x", "]"}]}], FontColor->GrayLevel[0.500008]], StyleBox[" ", FontColor->GrayLevel[0.500008]], StyleBox[ RowBox[{"(*", RowBox[{"any", " ", RowBox[{"f", "[", "]"}]}], "*)"}], FontColor->GrayLevel[0.500008]]}], "Output"], "\[IndentingNewLine]", StyleBox[ StyleBox[ RowBox[{ RowBox[{ SubscriptBox["\[PartialD]", "t"], " ", RowBox[{"u", "[", RowBox[{"x", ",", StyleBox[ StyleBox[ StyleBox[ StyleBox[ StyleBox[ StyleBox["0", "Output", FontColor->GrayLevel[0.500008]], "Output", FontColor->GrayLevel[0.500008]], "Output", FontColor->GrayLevel[0.500008]], "Output", FontColor->GrayLevel[0.500008]], "Output", FontColor->GrayLevel[0.500008]], "Output", FontColor->GrayLevel[0.500008]]}], "]"}]}], "=", RowBox[{"g", "[", "x", "]"}], " ", RowBox[{"(*", RowBox[{"any", " ", RowBox[{"g", "[", "]"}]}], "*)"}]}], FontColor->GrayLevel[0.500008]], "Output"]}], "Input", CellChangeTimes->{{3.395426592144389*^9, 3.3954266050332127`*^9}}], Cell["The command", "Text", CellChangeTimes->{{3.3954265548122063`*^9, 3.3954265569180202`*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"DSolve", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{ SuperscriptBox["c", "2"], RowBox[{ SubscriptBox["\[PartialD]", RowBox[{"x", ",", "x"}]], RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}]}], "-", RowBox[{ SubscriptBox["\[PartialD]", RowBox[{"t", ",", "t"}]], RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}]}], "\[Equal]", "0"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"u", "[", RowBox[{"x", ",", "0"}], "]"}], "==", RowBox[{"f", "[", "x", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ SubscriptBox["\[PartialD]", "t"], " ", RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}], "==", RowBox[{"g", "[", "x", "]"}]}]}], "}"}], ",", RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", "t"}], "}"}]}], "]"}]], "Input", CellChangeTimes->{{3.395426617081291*^9, 3.3954266200162973`*^9}}], Cell[BoxData[ RowBox[{"DSolve", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"-", RowBox[{ SuperscriptBox["u", TagBox[ RowBox[{"(", RowBox[{"0", ",", "2"}], ")"}], Derivative], MultilineFunction->None], "[", RowBox[{"x", ",", "t"}], "]"}]}], "+", RowBox[{ SuperscriptBox["c", "2"], " ", RowBox[{ SuperscriptBox["u", TagBox[ RowBox[{"(", RowBox[{"2", ",", "0"}], ")"}], Derivative], MultilineFunction->None], "[", RowBox[{"x", ",", "t"}], "]"}]}]}], "\[Equal]", "0"}], ",", RowBox[{ RowBox[{"u", "[", RowBox[{"x", ",", "0"}], "]"}], "\[Equal]", RowBox[{"f", "[", "x", "]"}]}], ",", RowBox[{ RowBox[{ SuperscriptBox["u", TagBox[ RowBox[{"(", RowBox[{"0", ",", "1"}], ")"}], Derivative], MultilineFunction->None], "[", RowBox[{"x", ",", "t"}], "]"}], "\[Equal]", RowBox[{"g", "[", "x", "]"}]}]}], "}"}], ",", RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", "t"}], "}"}]}], "]"}]], "Output", CellChangeTimes->{3.3954266325231647`*^9}] }, Open ]], Cell[TextData[{ "got us nowhere. Yet we learn from books that an elegant solution of that \ initial value problem was known already (by about 1750) to ", Cell[BoxData[ TagBox[ ButtonBox[ PaneSelectorBox[{False->"\<\"d'Alembert\"\>", True-> StyleBox["\<\"d'Alembert\"\>", "HyperlinkActive"]}, Dynamic[ CurrentValue["MouseOver"]], BaselinePosition->Baseline, FrameMargins->0, ImageSize->Automatic], BaseStyle->"Hyperlink", ButtonData->{ URL[ "http://www-history.mcs.st-andrews.ac.uk/Biographies/D'Alembert.html"], None}, ButtonNote-> "http://www-history.mcs.st-andrews.ac.uk/Biographies/D'Alembert.html"], Annotation[#, "http://www-history.mcs.st-andrews.ac.uk/Biographies/D'Alembert.html", "Hyperlink"]& ]], CellChangeTimes->{3.396093125909492*^9}], " (who initiated the study of strings, and thus of PDEs):" }], "Text", CellChangeTimes->{{3.395426657004282*^9, 3.395426679974468*^9}, 3.396093165161992*^9}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}], "=", RowBox[{ RowBox[{ FractionBox["1", "2"], RowBox[{"(", RowBox[{ RowBox[{"f", "[", RowBox[{"x", "+", RowBox[{"c", " ", "t"}]}], "]"}], "+", RowBox[{"f", "[", RowBox[{"x", "-", RowBox[{"c", " ", "t"}]}], "]"}]}], ")"}]}], "+", RowBox[{ FractionBox["1", RowBox[{"2", "c"}]], RowBox[{ SubsuperscriptBox["\[Integral]", RowBox[{"x", "-", RowBox[{"c", " ", "t"}]}], RowBox[{"x", "+", RowBox[{"c", " ", "t"}]}]], RowBox[{ RowBox[{"g", "[", "\[Xi]", "]"}], RowBox[{"\[DifferentialD]", "\[Xi]"}]}]}]}]}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ FractionBox["1", "2"], " ", RowBox[{"(", RowBox[{ RowBox[{"f", "[", RowBox[{ RowBox[{ RowBox[{"-", "c"}], " ", "t"}], "+", "x"}], "]"}], "+", RowBox[{"f", "[", RowBox[{ RowBox[{"c", " ", "t"}], "+", "x"}], "]"}]}], ")"}]}], "+", FractionBox[ RowBox[{ SubsuperscriptBox["\[Integral]", RowBox[{ RowBox[{ RowBox[{"-", "c"}], " ", "t"}], "+", "x"}], RowBox[{ RowBox[{"c", " ", "t"}], "+", "x"}]], RowBox[{ RowBox[{"g", "[", "\[Xi]", "]"}], RowBox[{"\[DifferentialD]", "\[Xi]"}]}]}], RowBox[{"2", " ", "c"}]]}]], "Output", CellChangeTimes->{3.395426775093081*^9}] }, Open ]], Cell[TextData[{ "And ", StyleBox["Mathematica", FontSlant->"Italic"], ", once pointed in the right direction, is quick to agree with d'Alembert: \ the function to which d'Alembert's formula leads does satisfy the wave \ equation" }], "Text", CellChangeTimes->{{3.3955070631501493`*^9, 3.395507095163982*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{ RowBox[{ SuperscriptBox["c", "2"], RowBox[{ SubscriptBox["\[PartialD]", RowBox[{"x", ",", "x"}]], RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}]}], "-", RowBox[{ SubscriptBox["\[PartialD]", RowBox[{"t", ",", "t"}]], RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}]}], "\[Equal]", "0"}], "//", "Simplify"}]], "Input", CellChangeTimes->{{3.395426811122068*^9, 3.395426814480546*^9}}], Cell[BoxData["True"], "Output", CellChangeTimes->{3.395426816812989*^9}] }, Open ]], Cell["and does conform to the prescribed initial conditions:", "Text", CellChangeTimes->{{3.3955071042459803`*^9, 3.395507113403678*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}], "/.", RowBox[{"t", "\[Rule]", "0"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ SubscriptBox["\[PartialD]", "t"], " ", RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}], "/.", RowBox[{"t", "\[Rule]", "0"}]}]}], "Input", CellChangeTimes->{{3.3954268448366747`*^9, 3.395426845393203*^9}}], Cell[BoxData[ RowBox[{"f", "[", "x", "]"}]], "Output", CellChangeTimes->{3.395426854628419*^9}], Cell[BoxData[ RowBox[{"g", "[", "x", "]"}]], "Output", CellChangeTimes->{3.3954268546673813`*^9}] }, Open ]], Cell[TextData[{ "It is when we decide to use these results to explore particular cases that \ ", StyleBox["Mathematica", FontSlant->"Italic"], " comes again most vividly into its own:" }], "Text"], Cell[BoxData[ RowBox[{"Clear", "[", "u", "]"}]], "Input", CellChangeTimes->{{3.395427018970614*^9, 3.395427021834179*^9}}], Cell["", "Text", CellChangeTimes->{{3.395426887055084*^9, 3.3954268871016827`*^9}}] }, Open ]], Cell[CellGroupData[{ Cell[TextData[StyleBox["First Example", FontColor->RGBColor[0, 0, 1]]], "Subsubsection", CellChangeTimes->{{3.3954269030690737`*^9, 3.395426907505034*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}], ":=", RowBox[{"Sin", "[", RowBox[{"t", "-", FractionBox["x", "c"]}], "]"}]}]], "Input"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{ SuperscriptBox["c", "2"], RowBox[{ SubscriptBox["\[PartialD]", RowBox[{"x", ",", "x"}]], RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}]}], "-", RowBox[{ SubscriptBox["\[PartialD]", RowBox[{"t", ",", "t"}]], RowBox[{"u", "[", RowBox[{"x", ",", "t"}], "]"}]}]}], "\[Equal]", "0"}]], "Input"], Cell[BoxData["True"], "Output", CellChangeTimes->{3.395427055999373*^9}] }, Open ]], Cell["\<\ If we wanted to display that result on the printed page we might assign c a \ convenient value (I set c = 1) and proceed\ \>", "Text", CellChangeTimes->{{3.395427782445846*^9, 3.39542784050953*^9}}], Cell[BoxData[ RowBox[{"c", "=", "1"}]], "Input", CellChangeTimes->{{3.395427814678503*^9, 3.395427819424745*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Plot3D", "[", RowBox[{ RowBox[{"Sin", "[", RowBox[{"t", "-", "x"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{ RowBox[{"-", "2"}], "\[Pi]"}], ",", RowBox[{"2", "\[Pi]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "6"}], "}"}], ",", RowBox[{"PlotPoints", "\[Rule]", "30"}], ",", "\[IndentingNewLine]", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\